package com.example.bbfindhouse.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

import com.example.bbfindhouse.R;

public class IndexActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);

        // 设置顶部导航栏"看点"点击事件
        TextView kandianTextView = findViewById(R.id.top_title_kandian);
        if (kandianTextView != null) {
            kandianTextView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, kandianActivity.class));
                }
            });
        }

        // 设置下方导航栏"租房"点击事件
        LinearLayout zufangLayout = findViewById(R.id.bottom_nav_zufang);
        if (zufangLayout != null) {
            zufangLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, zufangActivity.class));
                }
            });
        }

        // 设置下方导航栏"卖房"点击事件
        LinearLayout maifangLayout = findViewById(R.id.bottom_nav_maifang);
        if (maifangLayout != null) {
            maifangLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, woyaomaifangActivity.class));
                }
            });
        }

        // 设置底部导航栏"个人中心"点击事件
        LinearLayout wodeLayout = findViewById(R.id.bottom_bar_wode);
        if (wodeLayout != null) {
            wodeLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, wodeActivity.class));
                }
            });
        }

        // 设置底部导航栏"消息"点击事件
        LinearLayout messageLayout = findViewById(R.id.bottom_bar_message);
        if (messageLayout != null) {
            messageLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, MessageActivity.class));
                }
            });
        }

        // 设置下方导航栏"新房"点击事件
        LinearLayout xinfangLayout = findViewById(R.id.bottom_nav_xinfang);
        if (xinfangLayout != null) {
            xinfangLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(IndexActivity.this, xinfangActivity.class));
                }
            });
        }
    }
}